/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hibernate;

import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import test.TestHibernate;

/**
 *
 * @author jhon
 */
@ManagedBean (name="hibernate")
@RequestScoped
public class Hibernate {

    public static String PERSISTENCE_UNIT_NAME = "hibernate-serverPU";
    public static int REPEATS = 1;
    public static int THREADS = 2;
    protected static volatile int executions;
    public static int MAX_CONNECTIONS = 10;
    public static int MIN_CONNECTIONS = 10;
    public static int REPETITIONS = 2;
    public static int STEP = 50;
    public static List<Long> results;

    /**
     * Creates a new instance of Hibernate
     */
    public Hibernate() {
    }

    public void main() {

        final EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);

        TestHibernate testHibernate = new TestHibernate(MAX_CONNECTIONS, MIN_CONNECTIONS, REPEATS, THREADS, REPETITIONS, STEP, emf);

        testHibernate.runAll();

        emf.close();
    }
}
